package com.awifi.com.thread.callable;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @description: ToDo
 * @author: marin
 * @time: 2020/6/29 15:06
 */
public class FutureTaskThread {
    public static void main(String[] args) {
        CallableThread callableThread = new CallableThread();
        FutureTask<Object> futureTask = new FutureTask<Object>(callableThread);
        new Thread(futureTask,"有返回值的线程").start();
        try
        {
            System.out.println("子线程的返回值："+futureTask.get());
        } catch (InterruptedException e)
        {
            e.printStackTrace();
        } catch (ExecutionException e)
        {
            e.printStackTrace();
        }
    }
}
